package com.ssish.saas.eccs.mapper;

import com.ssish.saas.eccs.model.Payor;
import com.ssish.saas.eccs.model.PayorExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface PayorMapper {
    int countByExample(PayorExample example);

    int deleteByExample(PayorExample example);

    @Delete({
        "delete from PAYOR",
        "where PAYOR_CODE = #{payorCode,jdbcType=CHAR}"
    })
    int deleteByPrimaryKey(String payorCode);

    @Insert({
        "insert into PAYOR (PAYOR_CODE, CARD_NO_PAYOR_ID, ",
        "SHORT_NAME, LONG_NAME, ",
        "ADDRESS, POSTCODE, ",
        "CITY, STATE, COUNTRY, ",
        "TEL_NO, FAX_NO, PAYOR_TYPE, ",
        "CONTACT_PERSON, EMAIL, ",
        "EDI_ADDRESS, COMM_CODE, ",
        "BANK_CODE, BANK_AC_NO, ",
        "ACTIVE_FLAG, LASTEDIT_DATE, ",
        "USER_CODE, PAYOR_CARD, ",
        "CARD_EXPIRY_MONTH, CARD_EXPIRY_YEAR, ",
        "ACCOUNT_NO, LOA_FLAG, FORM_HEADER_ID, ",
        "ENGLISH_NAME, ENGLISH_ADDR, ",
        "CURRCD, REIMBURSEMENT_PAYMENT, ",
        "AGENT_INFO, NETWORK_CODE, ",
        "ENROLLMENT_SUBMIT_TYPE, ENROLLMENT_PROCESS_TYPE, ",
        "GENERATE_ENROLLMENT_LOG, GENERATE_CLAIMS_DOWNLOAD, ",
        "INSERT_BY, INSERT_DATE, ",
        "ENROLLMENT_TERMINATION_TYPE, TERMINATION_TIME_BY, ",
        "OVERDUE_TERMINATION_DAYS)",
        "values (#{payorCode,jdbcType=CHAR}, #{cardNoPayorId,jdbcType=DECIMAL}, ",
        "#{shortName,jdbcType=VARCHAR}, #{longName,jdbcType=VARCHAR}, ",
        "#{address,jdbcType=OTHER}, #{postcode,jdbcType=VARCHAR}, ",
        "#{city,jdbcType=VARCHAR}, #{state,jdbcType=VARCHAR}, #{country,jdbcType=VARCHAR}, ",
        "#{telNo,jdbcType=VARCHAR}, #{faxNo,jdbcType=VARCHAR}, #{payorType,jdbcType=CHAR}, ",
        "#{contactPerson,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, ",
        "#{ediAddress,jdbcType=VARCHAR}, #{commCode,jdbcType=CHAR}, ",
        "#{bankCode,jdbcType=CHAR}, #{bankAcNo,jdbcType=VARCHAR}, ",
        "#{activeFlag,jdbcType=CHAR}, #{lasteditDate,jdbcType=TIMESTAMP}, ",
        "#{userCode,jdbcType=VARCHAR}, #{payorCard,jdbcType=DECIMAL}, ",
        "#{cardExpiryMonth,jdbcType=CHAR}, #{cardExpiryYear,jdbcType=CHAR}, ",
        "#{accountNo,jdbcType=CHAR}, #{loaFlag,jdbcType=CHAR}, #{formHeaderId,jdbcType=DECIMAL}, ",
        "#{englishName,jdbcType=VARCHAR}, #{englishAddr,jdbcType=VARCHAR}, ",
        "#{currcd,jdbcType=VARCHAR}, #{reimbursementPayment,jdbcType=CHAR}, ",
        "#{agentInfo,jdbcType=CHAR}, #{networkCode,jdbcType=VARCHAR}, ",
        "#{enrollmentSubmitType,jdbcType=CHAR}, #{enrollmentProcessType,jdbcType=CHAR}, ",
        "#{generateEnrollmentLog,jdbcType=CHAR}, #{generateClaimsDownload,jdbcType=CHAR}, ",
        "#{insertBy,jdbcType=VARCHAR}, #{insertDate,jdbcType=TIMESTAMP}, ",
        "#{enrollmentTerminationType,jdbcType=CHAR}, #{terminationTimeBy,jdbcType=CHAR}, ",
        "#{overdueTerminationDays,jdbcType=CHAR})"
    })
    int insert(Payor record);

    int insertSelective(Payor record);

    List<Payor> selectByExample(PayorExample example);

    @Select({
        "select",
        "PAYOR_CODE, CARD_NO_PAYOR_ID, SHORT_NAME, LONG_NAME, ADDRESS, POSTCODE, CITY, ",
        "STATE, COUNTRY, TEL_NO, FAX_NO, PAYOR_TYPE, CONTACT_PERSON, EMAIL, EDI_ADDRESS, ",
        "COMM_CODE, BANK_CODE, BANK_AC_NO, ACTIVE_FLAG, LASTEDIT_DATE, USER_CODE, PAYOR_CARD, ",
        "CARD_EXPIRY_MONTH, CARD_EXPIRY_YEAR, ACCOUNT_NO, LOA_FLAG, FORM_HEADER_ID, ENGLISH_NAME, ",
        "ENGLISH_ADDR, CURRCD, REIMBURSEMENT_PAYMENT, AGENT_INFO, NETWORK_CODE, ENROLLMENT_SUBMIT_TYPE, ",
        "ENROLLMENT_PROCESS_TYPE, GENERATE_ENROLLMENT_LOG, GENERATE_CLAIMS_DOWNLOAD, ",
        "INSERT_BY, INSERT_DATE, ENROLLMENT_TERMINATION_TYPE, TERMINATION_TIME_BY, OVERDUE_TERMINATION_DAYS",
        "from PAYOR",
        "where PAYOR_CODE = #{payorCode,jdbcType=CHAR}"
    })
    @ResultMap("BaseResultMap")
    Payor selectByPrimaryKey(String payorCode);

    int updateByExampleSelective(@Param("record") Payor record, @Param("example") PayorExample example);

    int updateByExample(@Param("record") Payor record, @Param("example") PayorExample example);

    int updateByPrimaryKeySelective(Payor record);

    @Update({
        "update PAYOR",
        "set CARD_NO_PAYOR_ID = #{cardNoPayorId,jdbcType=DECIMAL},",
          "SHORT_NAME = #{shortName,jdbcType=VARCHAR},",
          "LONG_NAME = #{longName,jdbcType=VARCHAR},",
          "ADDRESS = #{address,jdbcType=OTHER},",
          "POSTCODE = #{postcode,jdbcType=VARCHAR},",
          "CITY = #{city,jdbcType=VARCHAR},",
          "STATE = #{state,jdbcType=VARCHAR},",
          "COUNTRY = #{country,jdbcType=VARCHAR},",
          "TEL_NO = #{telNo,jdbcType=VARCHAR},",
          "FAX_NO = #{faxNo,jdbcType=VARCHAR},",
          "PAYOR_TYPE = #{payorType,jdbcType=CHAR},",
          "CONTACT_PERSON = #{contactPerson,jdbcType=VARCHAR},",
          "EMAIL = #{email,jdbcType=VARCHAR},",
          "EDI_ADDRESS = #{ediAddress,jdbcType=VARCHAR},",
          "COMM_CODE = #{commCode,jdbcType=CHAR},",
          "BANK_CODE = #{bankCode,jdbcType=CHAR},",
          "BANK_AC_NO = #{bankAcNo,jdbcType=VARCHAR},",
          "ACTIVE_FLAG = #{activeFlag,jdbcType=CHAR},",
          "LASTEDIT_DATE = #{lasteditDate,jdbcType=TIMESTAMP},",
          "USER_CODE = #{userCode,jdbcType=VARCHAR},",
          "PAYOR_CARD = #{payorCard,jdbcType=DECIMAL},",
          "CARD_EXPIRY_MONTH = #{cardExpiryMonth,jdbcType=CHAR},",
          "CARD_EXPIRY_YEAR = #{cardExpiryYear,jdbcType=CHAR},",
          "ACCOUNT_NO = #{accountNo,jdbcType=CHAR},",
          "LOA_FLAG = #{loaFlag,jdbcType=CHAR},",
          "FORM_HEADER_ID = #{formHeaderId,jdbcType=DECIMAL},",
          "ENGLISH_NAME = #{englishName,jdbcType=VARCHAR},",
          "ENGLISH_ADDR = #{englishAddr,jdbcType=VARCHAR},",
          "CURRCD = #{currcd,jdbcType=VARCHAR},",
          "REIMBURSEMENT_PAYMENT = #{reimbursementPayment,jdbcType=CHAR},",
          "AGENT_INFO = #{agentInfo,jdbcType=CHAR},",
          "NETWORK_CODE = #{networkCode,jdbcType=VARCHAR},",
          "ENROLLMENT_SUBMIT_TYPE = #{enrollmentSubmitType,jdbcType=CHAR},",
          "ENROLLMENT_PROCESS_TYPE = #{enrollmentProcessType,jdbcType=CHAR},",
          "GENERATE_ENROLLMENT_LOG = #{generateEnrollmentLog,jdbcType=CHAR},",
          "GENERATE_CLAIMS_DOWNLOAD = #{generateClaimsDownload,jdbcType=CHAR},",
          "INSERT_BY = #{insertBy,jdbcType=VARCHAR},",
          "INSERT_DATE = #{insertDate,jdbcType=TIMESTAMP},",
          "ENROLLMENT_TERMINATION_TYPE = #{enrollmentTerminationType,jdbcType=CHAR},",
          "TERMINATION_TIME_BY = #{terminationTimeBy,jdbcType=CHAR},",
          "OVERDUE_TERMINATION_DAYS = #{overdueTerminationDays,jdbcType=CHAR}",
        "where PAYOR_CODE = #{payorCode,jdbcType=CHAR}"
    })
    int updateByPrimaryKey(Payor record);
}